package com.aier.admin.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.aier.admin.service.IAdminAssignCardService;
import com.aier.school.entity.School;
import com.aier.school.service.ISchoolService;

@Scope("prototype")
@Component("adminQuickICAction")
public class AdminQuickICAction extends AdminBaseAction {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    @Resource(name="schoolService")
    private ISchoolService schoolService;
    @Resource(name = "adminAssignCardService")
    private IAdminAssignCardService adminAssignCardService;
    
    private int s;
    
    // 学校列表
    private List<School> schoolList;
    
    private Integer sid;
    private String cardnum;
    
    /**
     * 进入
     */
    @Override
    public String execute(){
        schoolList = schoolService.searchAllSchoolList();
        return SUCCESS;
    }
    
    /**
     * 分派卡
     * @return
     */
    public String assign() {
        s = adminAssignCardService.insertCardSchool(sid, cardnum);
        return SUCCESS;
    }
    
    /**
     * 回收卡
     * @return
     */
    public String recover() {
        s = adminAssignCardService.updateCardRecover(cardnum);
        return SUCCESS;
    }
    
    public String w(){
        
        return SUCCESS;
    }

    public int getS() {
        return s;
    }

    public List<School> getSchoolList() {
        return schoolList;
    }

    public void setSchoolService(ISchoolService schoolService) {
        this.schoolService = schoolService;
    }

    public void setAdminAssignCardService(
            IAdminAssignCardService adminAssignCardService) {
        this.adminAssignCardService = adminAssignCardService;
    }

    public void setSid(Integer sid) {
        this.sid = sid;
    }

    public void setCardnum(String cardnum) {
        this.cardnum = cardnum;
    }

}
